package com.dtranx.tools.corpora.ability.search;

import co.elastic.clients.elasticsearch._types.query_dsl.BoolQuery;
import com.dtranx.tools.corpora.ability.constants.EsConstants;
import com.dtranx.tools.corpora.ability.vo.MatchingVo;
import com.dtranx.tools.corpora.abilityapi.enums.SearchMode;

/**
 * @Description
 * @Author zl
 * @Date 2025/7/3 9:58
 */
public class MatchSearchModeSearch extends AbstractModeSearch {

    @Override
    public void buildQueryBuilder0(BoolQuery.Builder queryBuilder, MatchingVo matchingVo) {
        matchingVo.setFuzzy(EsConstants.ALL_MINIMUM_SHOULD_MATCH);
        queryBuilder.must(matchQuery(matchingVo, matchingVo.getValue()));
    }

    @Override
    public SearchMode getMode() {
        return SearchMode.MATCH_SEARCH;
    }
}
